<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-cache,no-store">
    <meta http-equiv="Expires" content="0">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <title>角色编辑</title>
    <link rel="stylesheet" th:href="@{/plugins/layui/css/layui.css}" media="all" />
    <link rel="stylesheet" th:href="@{/plugins/font-awesome/css/font-awesome.min.css}" media="all" />
    <link rel="stylesheet" th:href="@{/src/css/app.css}" media="all" />
    <link rel="stylesheet" th:href="@{/src/css/themes/default.css}" media="all" id="skin" kit-skin />
</head>
<body class="layui-container">
<br/>
<form class="layui-form" method="POST">
    <input type="hidden" name="roleId" th:value="${record.roleId}"/>
    <div class="layui-form-item">
        <label class="layui-form-label">角色标记</label>
        <div class="layui-input-block">
            <input type="text" name="roleKey" th:value="${record.roleKey}" maxlength="20" lay-verify="required" autocomplete="off" placeholder="请输入角色标记" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-block">
            <input type="text" name="roleName" th:value="${record.roleName}" maxlength="20" lay-verify="required" autocomplete="off" placeholder="请输入角色名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">角色描述</label>
        <div class="layui-input-block">
            <textarea name="roleDesc" placeholder="请输入角色描述" maxlength="200" class="layui-textarea" th:text="${record.roleDesc}"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="save">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<!-- 引用layer基本js -->
<script th:src="@{/plugins/layui/layui.js}"></script>
<script>
    layui.config({
        base : '../../build/js/',
        version : '1.0.1'
    }).use(['form', 'common'], function() {
        var app = layui.app, $ = layui.jquery, layer = layui.layer,
            common = layui.common, form = layui.form;

        /**保存*/
        form.on("submit(save)", function(data) {
            var url = "/auth/role/updateRole.json";
            //异步表单提交
            common.fromPostAjax(url, data.field);
            return false;
        });
    })
</script>
</body>
</html>